{% extends 'task_market/base.html' %}
{% load static %}


{% block title %}
    主页
{% endblock %}

{% block content %}

    <section class="hero-slider bg-grey">
        <div class="container">
            <div class="main-hero-slider owl-carousel owl-theme">

                <div class="item">
                    <div class="single-slider item">
                        <div class="row">
                            <div class="col-lg-7 col-md-8 my-auto">
                                <div class="text-inner">
                                    <div class="hero-text">
                                        <h1><span>数据标注 </span>众包任务平台</h1>
                                        <p>这是一个数据标注众包平台 <br> 我们提供语义分析、图片分类、图像框选等功能 <br> 快来发布任务、领取任务，开始标注吧！</p>
                                        <div class="button">
                                            <a href="/task_market/all_grid/" class="btn">开始！</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-5 col-md-4 my-auto">
                                <img src="{% static 'temp_shop/assets/img/index001.jpg' %}" class="w-100" alt="">
                            </div>
                        </div>
                    </div>
                </div>


                <div class="item">
                    <div class="single-slider item">
                        <div class="row">
                            <div class="col-lg-7 col-md-8 my-auto">
                                <div class="text-inner">
                                    <div class="hero-text">
                                        <h1><span>数据标注 </span>众包任务平台</h1>
                                        <p>这是一个数据标注众包平台 <br> 我们提供语义分析、图片分类、图像框选等功能 <br> 快来发布任务、领取任务，开始标注吧！</p>
                                        <div class="button">
                                            <a href="/task_market/all_grid/" class="btn">开始！</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-5 col-md-4 my-auto">
                                <img src="{% static 'temp_shop/assets/img/index002.png' %}" class="w-100" alt="">
                            </div>
                        </div>
                    </div>
                </div>


                <div class="item">
                    <div class="single-slider item">
                        <div class="row">
                            <div class="col-lg-7 col-md-8  my-auto">
                                <div class="text-inner">
                                   <div class="hero-text">
                                        <h1><span>数据标注 </span>众包任务平台</h1>
                                        <p>这是一个数据标注众包平台 <br> 我们提供语义分析、图片分类、图像框选等功能 <br> 快来发布任务、领取任务，开始标注吧！</p>
                                        <div class="button">
                                            <a href="/task_market/all_grid/" class="btn">开始！</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-5 col-md-4 my-auto">
                                <img src="{% static 'temp_shop/assets/img/index003.png' %}" class="w-100" alt="">
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </section>

    <div class="product-area section">
        <div class="container">

            {% if type == 1 %}
                <div class="row">
                    <div class="col-12">
                        <div class="section-title d-flex justify-content-between align-center">
                            <div class="d-flex section-title-left">
                                <i class="flaticon-tags"></i>
                                <h2>任务信息</h2>
                            </div>
                            <div class="section-title-right">
                                <a href="{% url 'task_market:all_grid' %}" target="_blank">View More <i
                                        class="far fa-long-arrow-right"></i></a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="product-slider owl-carousel owl-theme">
                    {% for task in tasks %}
                        <div class="item">
                            <div class="single-product">
                                <div class="product-img">
                                    <a href="{% url 'task_market:details' id=task.id %}" target="_blank">
                                        <img class="product-img"
                                             src="{% static 'temp_shop/assets/img/task001.png' %}"
                                             alt="#">
                                        <span class="new">{{ task.id }}</span>
                                    </a>
                                    <div class="button-head">
                                        <div class="product-action">
                                            <a data-bs-toggle="modal" data-bs-target="#staticBackdrop{{ task.id }}"
                                               href="#"><i class="far fa-eye"></i><span>Quick Shop</span></a>
                                        </div>
                                    </div>
                                </div>
                                <div class="product-content">
                                    <h3><a href="{% url 'task_market:details' id=task.id %}"
                                           target="_blank">{{ task.task_name }}</a></h3>
                                    <div class="d-flex justify-content-between">
                                        <div class="product-price" style="color: red;">
                                            <span>任务等级：{{ task.task_rank }}</span>
                                        </div>
                                    </div>
                                    <div class="d-flex justify-content-between">
                                        <div class="product-price">
                                            <span>薪资标准：{{ task.task_salary }}元/条</span>
                                        </div>
                                        <button class="product-cart-btn" type="button"><a
                                                href="{% url 'task_market:task_apply' task_id=task.id %}">申请</a>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    {% endfor %}
                </div>
            {% elif type == '1209' or type == 2 %}
                <div class="row">
                    <div class="col-12">
                        <div class="section-title d-flex justify-content-between align-center">
                            <div class="d-flex section-title-left">
                                <i class="flaticon-tags"></i>
                                <h2>任务信息</h2>
                            </div>
                            <div class="section-title-right">
                                <a href="{% url 'task_market:all_grid' %}" target="_blank">View More <i
                                        class="far fa-long-arrow-right"></i></a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="product-slider owl-carousel owl-theme">
                    {% for task in tasks %}
                        <div class="item">
                            <div class="single-product">
                                <div class="product-img">
                                    <a href="{% url 'task_market:details' id=task.id %}" target="_blank">
                                        <img class="product-img"
                                             src="{% static 'temp_shop/assets/img/task001.png' %}"
                                             alt="#">
                                        <span class="new">{{ task.id }}</span>
                                    </a>
                                    <div class="button-head">
                                        <div class="product-action">
                                            <a data-bs-toggle="modal" data-bs-target="#staticBackdrop{{ task.id }}"
                                               href="#"><i class="far fa-eye"></i><span>Quick Shop</span></a>
                                        </div>
                                    </div>
                                </div>
                                <div class="product-content">
                                    <h3><a href="{% url 'task_market:details' id=task.id %}"
                                           target="_blank">{{ task.task_name }}</a></h3>
                                    <div class="d-flex justify-content-between">
                                        <div class="product-price" style="color: red;">
                                            <span>任务等级：{{ task.task_rank }}</span>
                                        </div>
                                    </div>
                                    <div class="d-flex justify-content-between">
                                        <div class="product-price">
                                            <span>薪资标准：{{ task.task_salary }}元/条</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    {% endfor %}
                </div>
            {% elif type == 0 %}
                <div class="row">
                    <div class="col-12">
                        <div class="section-title d-flex justify-content-between align-center">
                            <div class="d-flex section-title-left">
                                <i class="flaticon-tags"></i>
                                <h2>任务市场</h2>
                            </div>
                            <div class="section-title-right">
                                <a href="{% url 'manager:task_admin' condition='checking' %}" target="_blank">View More <i
                                        class="far fa-long-arrow-right"></i></a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="product-slider owl-carousel owl-theme">
                    {% for task in tasks %}
                        {% if task.task_status == 0 %}
                            <div class="item">
                                <div class="single-product">
                                    <div class="product-img">
                                        <a href="{% url 'manager:task_check' id=task.id %}" target="_blank">
                                            <img class="product-img"
                                                 src="{% static 'temp_shop/assets/img/task001.png' %}"
                                                 alt="#">
                                            <span class="out-of-stock">待审核</span>
                                        </a>
                                    </div>
                                    <div class="product-content">
                                        <h3><a href="{% url 'manager:task_check' id=task.id %}"
                                               target="_blank">{{ task.task_name }}</a></h3>
                                        <div class="d-flex justify-content-between">
                                            <div class="product-price" style="color: red;">
                                                <span>任务等级：{{ task.task_rank }}</span>
                                            </div>
                                        </div>
                                        <div class="d-flex justify-content-between">
                                            <div class="product-price">
                                                <span>薪资标准：{{ task.task_salary }}元/条</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        {% elif task.task_status == 1 or task.task_status == 2 %}
                            <div class="item">
                                <div class="single-product">
                                    <div class="product-img">
                                        <a href="{% url 'manager:detail_everytask' id=task.id %}" target="_blank">
                                            <img class="product-img"
                                                 src="{% static 'temp_shop/assets/img/task001.png' %}"
                                                 alt="#">
                                            <span class="new">已审核</span>
                                        </a>
                                    </div>
                                    <div class="product-content">
                                        <h3><a href="{% url 'manager:detail_everytask' id=task.id %}"
                                               target="_blank">{{ task.task_name }}</a></h3>
                                        <div class="d-flex justify-content-between">
                                            <div class="product-price" style="color: red;">
                                                <span>任务等级：{{ task.task_rank }}</span>
                                            </div>
                                        </div>
                                        <div class="d-flex justify-content-between">
                                            <div class="product-price">
                                                <span>薪资标准：{{ task.task_salary }}元/条</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        {% endif %}
                    {% endfor %}
                </div>
            {% endif %}
        </div>
    </div>

{% endblock %}

{% block view %}

    {% for task in tasks %}
        <div class="modal" id="staticBackdrop{{ task.id }}" data-bs-backdrop="static" data-bs-keyboard="false"
             tabindex="-1" aria-labelledby="staticBackdrop" aria-hidden="true">
            <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
                <div class="modal-content">
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12">
                                <img src="{% static 'temp_shop/assets/img/products/p1.png' %}" alt="#">
                            </div>
                            <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12">
                                <div class="quickview-content">
                                    <div class="d-flex mb-3"></div>
                                    <h2>{{ task.task_name }}</h2>
                                    <div class="d-flex mb-3">
                                        <span>任务描述：</span>
                                    </div>
                                    <div class="d-flex mb-3">
                                        <b>{{ task.task_description }}</b>
                                    </div>
                                    <div class="d-flex mb-3"></div>
                                    <div class="d-flex mb-3">
                                        <span>薪资标准：</span>
                                    </div>
                                    <h2>{{ task.task_salary }}元/条</h2>
                                    <div class="add-to-cart">
                                        <a href="{% url 'task_market:details' id=task.id %}" class="btn">详情信息</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    {% endfor %}

{% endblock %}